#pragma once

namespace AVUI
{

class DeferredReference : public Object
{
public:
    DECLARE_ELEMENT(DeferredReference, Object);

    virtual ObjectPtr GetValue(BaseValueSource::Enum valueSource) = 0;
    virtual const Type* GetValueType() = 0;
};

class DeferredMutableDefaultReference : public DeferredReference
{
public:

    DeferredMutableDefaultReference(PropertyMetadata* pMetadata, DependencyObject* pDO, DependencyProperty* pDP) : m_pSourceMetadata(pMetadata), m_pSourceObject(pDO), m_pSourceProperty(pDP) { };
    ObjectPtr GetValue(BaseValueSource::Enum valueSource) AVUI_OVERRIDE
    {
        return m_pSourceMetadata->GetDefaultValue(m_pSourceObject, m_pSourceProperty);
    }
    const Type* GetValueType() AVUI_OVERRIDE
    {
        return m_pSourceProperty->get_PropertyType();
    }

    PropertyMetadata* get_SourceMetadata() { return m_pSourceMetadata; }

protected:

    DependencyObject* get_SourceObject() { return m_pSourceObject; }
    DependencyProperty* get_SourceProperty() { return m_pSourceProperty; }

private:
    PropertyMetadata* m_pSourceMetadata;
    DependencyObject* m_pSourceObject;
    DependencyProperty* m_pSourceProperty;
};


}

